package ru.isys.yoomee.util.timemap;

import ru.isys.yoomee.model.Venue;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.OvalShape;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.OverlayItem;

public class TimemapItem extends OverlayItem
{

    Venue venue;
    
    public TimemapItem(GeoPoint arg0, String arg1, String arg2, Venue venue)
    {
        super(arg0, arg1, arg2); 
        this.venue=venue;
    }
    
    @Override
    public Drawable getMarker(int arg0)
    {        
        int size = prepareCircleSize();
        Canvas canvas = new Canvas();
        
        
        Paint malePaint = new Paint();
        Paint femalePaint = new Paint();
        
        malePaint.setColor(Color.parseColor("#83c4e0"));
        femalePaint.setColor(Color.parseColor("#d1798e"));
        RectF rect = new RectF(size/2, size/2, size/2, size/2);
        rect.set(getWidth()/2- mRadius, getHeight()/2 - mRadius, getWidth()/2 + mRadius, getHeight()/2 + mRadius); 
        
        canvas.drawArc(rect, 0, 60, false, paint1);
        canvas.drawArc(rect, 60, 60, false, paint2);
        
        ShapeDrawable drawable = new ShapeDrawable(new OvalShape());
        drawable.getPaint().setColor(Color.parseColor("#83c4e0"));        
        drawable.setBounds(-size/2, -size/2, size/2, size/2);
        drawable.setAlpha(125);
        return drawable;
    }

    private int prepareCircleSize(){
        int numberOfYoos = venue.getCheckinedYoos().size();
        int size = 40+numberOfYoos*2;
        return size>100? 100:size;
        
    }
    
}
